
<!--    //////////////////////////////////////////////////////////////////////-->
<div id="demoWrapper">
    <!--    <h1>Online Affidavit</h1>-->



    <?php
    $form = $this->beginWidget('GxActiveForm', array(
        'id' => 'demoForm',
        'enableAjaxValidation' => true,
        'htmlOptions' => array('class' => "bbq")
            ));
    ?>
    <!--        <form id="demoForm" method="post" action="json.html" class="bbq">-->
    <div id="fieldWrapper">
        <div class="step" id="first">
<!--            <span class="font_normal_07em_black">Personal Details</span><br />-->


            <?php
              $this->renderPartial('//amanStudentDetails/_studentDetail', array('form' => $form, 'model' => $model));
            ?>

        </div>
        <div id="second" class="step">
<!--            <span class="font_normal_07em_black">Parent/Guardian details</span>-->

            <?php
             $this->renderPartial('//amanStudentParentsDetail/_parentDetail', array('form' => $form, 'amanStudentParentsDetail' => $amanStudentParentsDetail));
            ?>
            <br />			
        </div>

        <div id="third" class="step">
<!--            <span class="font_normal_07em_black">College details</span>-->

            <?php
              $this->renderPartial('//amanStudentCollegeDetails/_college', array('form' => $form, 'amanStudentCollegeDetails' => $amanStudentCollegeDetails));
            ?>
            <br />	 						
        </div>
        <div id="fourth" class="step">
<!--            <span class="font_normal_07em_black">College details</span>-->

            <?php
              $this->renderPartial('//amanStudentCourseDetails/_courseDetails', array('form' => $form, 'amanStudentCourseDetails' => $amanStudentCourseDetails));
            ?>
            <br />	 						
        </div>
        <div id="confirmation" class="step submit_step">


            <?php
            $this->renderPartial('//amanStudentCollegeDetails/_terms_and_condition', array('form' => $form, 'amanStudentCollegeDetails' => $amanStudentCollegeDetails));
            ?>
            <br />
        </div>
    </div>
    <div id="demoNavigation" > 							
        <input class="btn btn-primary" id="back" value="Back" type="reset" />
        <input class="btn btn-primary" id="next" value="Next" type="submit" />

    </div>
    <!--        </form>-->
    <?php
    $this->endWidget();
    ?>
    <hr />

    <p id="data"></p>
</div>
<?php
Yii::app()->clientScript->registerCoreScript('jquery.ui');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery-1.4.2.min.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery.form.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery.validate.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/bbq.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery-ui-1.8.5.custom.min.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/jquery.form.wizard.js');
?>


<script type="text/javascript">


    $(function() {
        $("#demoForm").formwizard({
            formPluginEnabled: true,
            validationEnabled: true,
            focusFirstInput: true,
            formOptions: {
                rules: {
                    ".chkbx": {
                        required: true,
                        minlength: 1
                    },
                    AmanStudentDetails_mobile_no: {
                        required: true,
                        minlength: 10,
                        maxlength: 10,
                       
                    },
                    AmanStudentParentsDetail_mobile_no: {
                        required: true,
                        minlength: 10,
                        maxlength: 10,
                       
                    },
                    AmanStudentDetails_alterne_no: {
                        required: true,
                        number:true	
                       
                    },
                    AmanStudentDetails_landline_no: {
                        required: true,
                        number:true	
                       
                    },
                    
                },
                messages: {
                   
                },
	

                success: function(data) {




                },
                beforeSubmit: function(data) {
                    
                    jQuery.ajax(
                    {
                        'type': 'POST',
                        'url': "<?php echo Yii::app()->createUrl('onlineAffidavit/saveFormData') ?>",
                        'data': jQuery("#demoForm").serializeArray(),
                        'beforeSend': function(jqXHR, settings) {

                        },
                        'success': function(data) {
                            if (data = 1) {
                           
                                jQuery("#data").fadeTo(500,1,function(){ 
                                    $(this).html("Data has been save successfully!").fadeTo(5000, 0); 
                                }),
                                    jQuery.fn.reset = function() {
                                        $(this).each(function() {
                                            this.reset();
                                        });
                                    }
                                    jQuery("#demoForm").reset();
                                }

                            },
                            'cache': false

                        })
                        //  $("#data").html("data sent to the server: " + $.param(data));
                    },
                    dataType: 'json',
                    resetForm: true
                }
            }
        );
        });
</script>